//
// Created by 谢哲 on 2021/5/17.
//

#include <iostream>
#include <vector>
#
using namespace std;

int main() {
    int n;
    cin >> n;
    int total = 1 << n;

    int max1 = 0, max2 = 0;
    int maxi1 = 0, maxi2 = 0;
    for (int i=0; i<total; ++i) {
        int a;
        cin >> a;
        if (i<total/2) {
            if (a>max1) {
                max1 = a, maxi1 = i+1;
            }
        }
        else {
            if (a>max2) {
                max2 = a, maxi2 = i+1;
            }
        }
    }

    if (max1>max2) {
        cout <<maxi2;
    }
    else {
        cout <<maxi1;
    }

    return 0;
}